CC=arm-elf-gcc
WARNINGS=-Wall -Wstrict-prototypes -Wno-trigraphs
INCL=-I. -I./INCLUDE
CFLAGS=$(INCL) $(WARNINGS) -O2 -mcpu=arm7tdmi 
LDFLAGS= -nostartfiles -N -Tlpc2292.ld -Xlinker -Map=Test_SDK_2_0.map

SRC_FILES = \
SRC/main.c \
SRC/Interrupt.c \
SRC/LCD_driver.c \
SRC/SysTimer_driver.c \
SRC/ADC_driver.c \
SRC/KeyBoard_driver.c \
SRC/Functions.c \
SRC/FloatArithmetic.c \
SRC/RS232_driver.c \

OBJ_FILES = $(SRC_FILES:.c=.o)

 
all: Test_SDK_2_0
 
Test_SDK_2_0: SRC/startup.o $(OBJ_FILES)
		$(CC) SRC/startup.o $(OBJ_FILES) $(LDFLAGS) -o Test_SDK_2_0
		arm-elf-objdump -xS Test_SDK_2_0 > Test_SDK_2_0.d
		arm-elf-objcopy -O ihex Test_SDK_2_0 Test_SDK_2_0.hex
		arm-elf-nm Test_SDK_2_0 > Test_SDK_2_0.n
#		rm -rf *.o
	 
SRC/startup.o: SRC/startup.s
		$(CC) -c $(CFLAGS) SRC/startup.s -o SRC/startup.o

$(OBJ_FILES): %.o : %.c
		$(CC) -c $(CFLAGS) $< -o $@


clean:
		find . -name "*.o" -delete
#		c:/cygwin/bin/find . -name "*.o" -delete
		rm -rf *.o *.elf *.gdb Test_SDK_2_0 *.r *.n *.d *.map

